﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Input;

namespace CPPEI.Coolzon.Designer.Views
{
    public static class AddSceneCommand
    {
        public static void Executed(object sender, ExecutedRoutedEventArgs e)
        {
            SceneWindow sw = new SceneWindow(UIContext.Current.CurrentSelectedNode.ID);
            sw.ShowDialog();
        }
        public static void CanExecute(object sender, CanExecuteRoutedEventArgs e)
        {
            if(UIContext.Current.CurrentSelectedNode != null && (UIContext.Current.CurrentSelectedNode.NodeType == NodeType.Solution || UIContext.Current.CurrentSelectedNode.NodeType == NodeType.Scene || UIContext.Current.CurrentSelectedNode.NodeType == NodeType.Folder))
            {
                if (Designtime.Metadata.SolutionHelper.GetScene(UIContext.Current.CurrentSolution, UIContext.Current.CurrentSelectedNode.ParentID) == null)
                {
                    e.CanExecute = true;
                    return;
                }
            }
            e.CanExecute = false;
        }
    }
}
